<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
         pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>CRUD de articulos.</title>
    </head>
    <body>
        <h3>Articulos :</h3>

        <!-- Imagenes de los hipervinculos -->
        <c:url var="editImgUrl" value="view/resources/images/edit.png" />
        <c:url var="deleteImgUrl" value="view/resources/images/delete.png" />

        <c:if test="${fn:length(Articulos) > 0}">

            <table style="border: 1px solid; width: 100%; text-align: center">
                <thead style="background: #d3dce3">
                    <tr>
                        <th>Codigo</th>
                        <th>Nombre</th>
                        <th>Marca</th>
                        <th colspan="2"></th>

                    </tr>
                </thead>

                <tbody style="background: #ccc">

                    <c:forEach items="${Articulos}" var="articulo">

                        <tr>
                            <td><c:out value="${articulo.idarticulo}" /></td>
                            <td><c:out value="${articulo.nombre}" /></td>
                            <td><c:out value="${articulo.marca.nombre}" /></td>
                            <td><a
                                    href="javascript:editarArticuloGet(${articulo.idarticulo})"><img
                                        src="${editImgUrl}"></img> </a></td>
                            <td><a
                                    href="javascript:showAsk('Desea borrar?',${articulo.idarticulo},3);"><img
                                        src="${deleteImgUrl}"></img> </a></td>


                        </tr>

                    </c:forEach>

                </tbody>
            </table>
            <p>
                <a href="javascript:addArticuloGet();">Crear Nuevo Articulo</a>
            </p>
        </c:if>

        <c:if test="${empty Articulos}">
	No se encontraron registros de Articulos para esta marca, <p>
                <a href="">Crear Nuevo Articulo</a>
            </p>
        </c:if>
        <br />

    </body>
</html>